package com.starleague.battletech.hexagonal.android;

import com.starleague.battletech.hexagonal.BattletechHexTerrainType;
import com.starleague.battletech.hexagonal.IBattletechHexGridFactory;
import com.starleague.hexagonal.HexException;
import com.starleague.hexagonal.IHexCoordinate;

/**
 * TODO: For Testing only! Move this somewhere else!!!
 */

public class AndroidBattletechHexGridFactory
        implements
        IBattletechHexGridFactory<AndroidBattletechHexGrid, AndroidBattletechHex, AndroidBattletechHexTerrain>
{
    @Override
    public AndroidBattletechHexGrid createHexGrid(int minGridX,
                                                  int minGridY,
                                                  int numHexesX,
                                                  int numHexesY) throws HexException
    {
        return new AndroidBattletechHexGrid(minGridX, minGridY, numHexesX, numHexesY);
    }

    @Override
    public AndroidBattletechHex createHex(AndroidBattletechHexGrid hexGrid,
                                          IHexCoordinate hexCoordinate,
                                          int elevation) throws HexException
    {
        AndroidBattletechHex hex = new AndroidBattletechHex(hexGrid, hexCoordinate, elevation);
        hexGrid.setHex(hex);
        return hex;
    }

    @Override
    public AndroidBattletechHexTerrain createHexTerrain(AndroidBattletechHex hex,
                                                        BattletechHexTerrainType hexTerrainType,
                                                        int level) throws HexException
    {
        AndroidBattletechHexTerrain hexTerrain = new AndroidBattletechHexTerrain(hex,
                                                                                 hexTerrainType,
                                                                                 level);
        hex.getHexTerrainList().add(hexTerrain);
        return hexTerrain;

    }

}
